import static org.junit.Assert.*;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class CheckingAccountTest {

//	public CheckingAccount(String name, String street, String zipcode, String town, String country)
//	public CheckingAccount(String name, String street, String zipCode, String town, String country, float debit)
// 	public CheckingAccount(int accountnumber)

	CheckingAccount testAccount;
	
	@Before
	public void setUp() throws Exception {
		Customer testCustomer = new Customer("test first name", "test last name", "test street", "test zip", "test town", "test country");
		testAccount = new CheckingAccount(testCustomer);
	}

	@After
	public void tearDown() throws Exception {
		testAccount = null;
	}

	@Test
	public void testDetermineCosts() {
		testAccount.balance = new BigDecimal("100000.00");
		BigDecimal balanceStart = testAccount.balance;
		testAccount.determineCosts();
		assertEquals(balanceStart.compareTo(testAccount.balance),1);
		
		testAccount.balance = new BigDecimal(0);
		testAccount.determineCosts();
		assertEquals(testAccount.balance.compareTo(new BigDecimal(0)),-1);
	}

	@Test
	public void testWithdrawalTrue() {
		BigDecimal startBalance = new BigDecimal("100.00");
		testAccount.balance = startBalance;
		assertTrue(testAccount.withdrawal(new BigDecimal("10.00")));
		BigDecimal endBalance = testAccount.balance;
		assertEquals(startBalance.compareTo(endBalance),1);
	}

	@Test
	public void testWithdrawalFalse() {
		testAccount.balance = new BigDecimal(0);
		assertFalse(testAccount.withdrawal(new BigDecimal("10.00")));
		assertEquals(testAccount.balance.compareTo(new BigDecimal(0)),0);
	}
	
	@Test
	public void testGetBalance() {
		assertEquals(testAccount.getBalance().compareTo(new BigDecimal("0.0")), 0);
	}

	@Test
	public void testGetAccountNumber() {
		assertEquals(testAccount.getAccountNumber(), testAccount.accountNumber);
	}

	@Test
	public void testEqualsObject() {
		assertTrue(testAccount.equals(testAccount));
	}
	
	@Test
	public void testPrint(){
		testAccount.print();
	}
}
